<template>
<div>
  <div><input type="text" v-model="searchText">  <span @click="toPath" style="cursor: pointer">图标</span></div>
  <div>
    <phonePic v-if="chooseModel==='phonePic'" :seach="searchText"></phonePic>
    <windowPic v-else :seach="searchText"></windowPic>
  </div>
</div>
</template>

<script>
import phonePic from "@/components/phonePic";
import windowPic from "@/components/windowPic";
import {mapState,mapMutations} from 'vuex'
export default {
name: "search",
  data(){
    return{
      searchText:""
    }
  },
  methods:{
    ...mapMutations(['toggle']),
    toPath(){
      var url=this.chooseModel
      if (url==='phonePic'){
        this.toggle('windowPic')
        return
      }else if(url==='windowPic'){
        this.toggle('phonePic')
        return
      }
    }
  },
  computed:{
    ...mapState(['chooseModel'])
  },
  components:{
    phonePic,
    windowPic
  }
}
</script>

<style scoped>

</style>
